import requests

# 获取代理 IP 和端口
res = requests.get("https://dps.kdlapi.com/api/getdps/?secret_id=o0tfppvezo885whdkya4&signature=eyv5hmqqb32zzg106y24rvrbjkndabfy&num=1&pt=1&format=text&sep=1")
# 去除多余的空白字符，包括换行符、制表符等
ip_port = res.text.strip()
username=""
password=""
proxies = {
    "http": f"http://{username}:{password}@{ip_port}",
    "https": f"http://{username}:{password}@{ip_port}"
}

try:
    res = requests.get("http://httpbin.org/get", proxies=proxies)
    print(f"IP: {res.json()['origin']}")
except requests.RequestException as e:
    print(f"请求出错: {e}")